<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>regex</title>
    <script>
        window.onload=function(){
           
            let reg1=document.getElementById("reg1");
            // reg1.addEventListener("onchange",function(){
            //     alert("hi");
            // });
            reg1.onkeyup=function(){

                this.value= this.value.replace(/kevin/g,'henry');
              console.log(this.value);
            }
            reg1.onchange=function(){
                console.log('change');
            }
        };
    </script>
</head>
<body>
    <input type="text" id="reg1">
</body>
</html>